"""
   @author:zhaocuixa
   @date:2022/10/21
   @function: 写入excel文件
"""

import xlsxwriter

# 写入excel
def writeExcel(wrtpath, sn, deviceId, query, pathall, path, triggerid, response, nlpconfig, newtts):
    wb = xlsxwriter.Workbook(wrtpath)
    sheet = wb.add_worksheet("Sheet")
    row1 = ['日志sn', '语料', '设备mac', '所有deviceAdapter请求', '选取的请求', 'triggerid', 'response', '朱雀平台配置的话术', '实际播报话术']
    for index, item in enumerate(row1):
        # print(index, item)
        sheet.write(0, index, item)  # 写入单元格数据

    for index, item in enumerate(sn):
        sheet.write(index + 1, 0, sn[index])  # 写入单元格数据
        sheet.write(index + 1, 1, query[index])
        sheet.write(index + 1, 2, deviceId[index])
        sheet.write(index + 1, 3, pathall[index])
        sheet.write(index + 1, 4, path[index])
        sheet.write(index + 1, 5, triggerid[index])
        sheet.write(index + 1, 6, response[index])
        sheet.write(index + 1, 7, str(nlpconfig[index]))
        sheet.write(index + 1, 8, newtts[index])
    wb.close()


if __name__ == '__main__':
    wrtpath = 'C:\\Users\\user\\Desktop\\datatrigger.xlsx'